home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 723 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. From: boukanov@sentef1.fi.uib.no (Igor Boukanov)
  2. Message-ID: <4ia9bj$atj@ugress.uib.no>
  3. X-Original-Date: 14 Mar 1996 23:16:03 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 15 Mar 96 00:33:41 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Access to private base class?
  9. Organization: Fysisk institutt, Universitetet i Bergen
  10. Summary: Some lines from DWP show how to get access to private base class(???).
  11. Keywords: C++, private class
  12. X-Newsreader: TIN [version 1.2 PL2]
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMUi7A+EDnX0m9pzZAQGQMgF+IvCNU8O9XV2SgL2IvtaChT2q8H+gd622
  15.     DurYTvDzkjVwH1PgOrumjNi7yzl2dy97
  16.     =7jjV
  17.  
  18. Here the lines from September DWP, 5.2.6.9:
  19.  
  20.  [Example:
  21. class A { virtual void f(); };
  22. class B { virtual void g(); };
  23. class D : public virtual A, private B {};
  24. void g()
  25. {
  26.     D   d;
  27.     B*  bp = (B*)&d;  // cast needed to break protection
  28. ...
  29.  
  30. Does "cast needed to break protection" mean that in this case it is possible 
  31. to get access to the private base class by simple cast expression? 
  32.  
  33. --
  34. Regards, Igor Boukanov (igor.boukanov@fi.uib.no).
  35. ---
  36. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  37. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  38. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  39. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  40. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  41.